package com.mars.tukuan.dto;

import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import com.mars.base.common.utils.date.DateUtil;
import com.mars.tukuan.entity.Car;
import com.mars.tukuan.utils.TimeUtils;

public class CarVo extends Car {

	private static final long serialVersionUID = 1L;

	//用户ID
	private String userId ;
	
	//是否新伤
	private Integer isHarm ;
	
	//逾期
	private String overdue ;

	//新伤数量
	private int totalHarm ;
	
	//最新更新时间
	private Date lastTime ;
	
	//图片数量
	private int countImgs ;
	
	//修复数量（处理后的图片数量）0：未修复，>0：有修复
	private int xfc ;
	
	//车辆检查数量
	private int countCheck ;

	public int getXfc() {
		return xfc;
	}

	public void setXfc(int xfc) {
		this.xfc = xfc;
	}

	public int getCountCheck() {
		return countCheck;
	}

	public void setCountCheck(int countCheck) {
		this.countCheck = countCheck;
	}

	public int getCountImgs() {
		return countImgs;
	}

	public void setCountImgs(int countImgs) {
		this.countImgs = countImgs;
	}

	public Date getLastTime() {
		return lastTime;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public Integer getIsHarm() {
		return isHarm;
	}

	public void setIsHarm(Integer isHarm) {
		this.isHarm = isHarm;
	}

	public int getTotalHarm() {
		return totalHarm;
	}

	public void setTotalHarm(int totalHarm) {
		this.totalHarm = totalHarm;
	}

	public String getOverdue() {
		if(null != this.getCheckTime()) {
			
			Date updateTime = this.getCheckTime() ;
			Calendar c1 = Calendar.getInstance();
			c1.setTime(updateTime);
			//加24小时
			c1.add(Calendar.HOUR_OF_DAY, 24);
			
			long ud = c1.getTime().getTime() ; //最近操作时间
			long cd = System.currentTimeMillis() ; //当前时间
			
			if(cd > ud) {
				Map<String, Long> d = TimeUtils.dateDiff(DateUtil.formatDateTime(c1.getTime()), DateUtil.getDateTime(), "yyyy-MM-dd HH:mm:ss") ;
				this.overdue = d.get("day").toString() + "天" + d.get("hour").toString() + "时" + d.get("min").toString() + "分" + d.get("sec").toString() + "秒" ;
			}
		}
		return overdue;
	}

	public void setOverdue(String overdue) {
		this.overdue = overdue;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
}
